package com.amrit.revision;

import java.util.HashMap;
import java.util.Map;

public class CollectionTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		MyThread mt = new MyThread("Demo Thread", 11);
		//HashMap
		HashMap<Object, Object> hm = new HashMap<Object, Object>();
		hm.put(new String("ABC"), "abc");
		hm.put("ABC", "abc");
		hm.put("CDE", "cde");
		hm.put("EFG", "efg");
		System.out.println(hm.containsValue("abc"));
		System.out.println(hm.containsValue("bbc"));
		for (Map.Entry<Object, Object> entry : hm.entrySet()) {
			System.out.println(entry.getKey() + " - values is --> "
					+ entry.getValue());
		}
		// LinkedList
		/*
		 * LinkedList<Object> ll = new LinkedList<Object>(); ll.add(hm);
		 * ll.add("String1"); ll.add(0, "First"); ll.add("String2"); ll.add(0,
		 * "Second"); ll.add("String3"); ll.add(0, "Third"); ll.add("String4");
		 * ll.add(0, "Fourth"); ll.add(mt);
		 * System.out.println("Last "+ll.getLast());
		 * System.out.println("First "+ll.getFirst()); System.out.println(ll);
		 * System.out.println(ll.getLast().getClass().getSimpleName());
		 * System.out.println(ll.getLast() instanceof MyThread); //ArrayList
		 * ArrayList<String> al = new ArrayList<String>(); al.add("A");
		 * al.add("b"); al.add(mt.toString()); System.out.println(al);
		 * 
		 * // Tree Set TreeSet<String> s = new TreeSet<String>(); s.add("A");
		 * s.add("b"); s.add("a"); s.add("B"); System.out.println("Set s is " +
		 * s); SortedSet<String> ss = new TreeSet<String>(); ss.add("A");
		 * ss.add("a"); ss.add("c"); ss.add("C"); ss.add("b"); ss.add("B"); //
		 * ss.add("c"); System.out.println("Set ss is " + ss);
		 * System.out.println(ss.first());
		 * 
		 * // HashSet HashSet<String> hs = new HashSet<String>(); hs.add("c");
		 * hs.add("C"); hs.add("A"); hs.add("A");
		 * System.out.println("HashSet hs is " + hs);
		 * 
		 * // HashTable Hashtable<String, Integer> ht = new Hashtable<String,
		 * Integer>(); ht.put("D", 4); ht.put("A", 1); ht.put("B", 2);
		 * ht.put("C", 3); System.out.println(ht.size());
		 * 
		 * String s1 = "Amrit"; System.out.println(s1.concat("Raj2"));
		 * System.out.println(s1); StringBuffer sb = new StringBuffer("Amrit");
		 * System.out.println("sb is " + sb); sb.append(" Raj3");
		 * System.out.println("now sb is " + sb);
		 */
	}

}